package com.study.spring.retry.retryByCustom;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author
 * @date 2021年11月16日 22:25
 * @description
 */
@Configuration
public class RetryConfig {


    @Bean
    public FastRetryStrategy fastRetryStrategy(){
        return new FastRetryStrategy();
    }

    @Bean
    public RetryListener defaultRetryListener(){
        return new DefaultRetryListener();
    }


    @Bean
    public ExecutorService retryThreadPool(){
        return new ThreadPoolExecutor(2, 4, 0L, TimeUnit.SECONDS, new LinkedBlockingQueue<>());
    }

}
